package com.czl.dxpro.dx_07_taskSeven;
import java.io.IOException;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import com.czl.dxpro.dx_01_clear.TProperties;
						  //Mapper<keyin(输入类型),keyvalue,keyout,keyvalue>
public class SevenMapper extends Mapper<LongWritable,Text,Text,IntWritable>{
@Override
	protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, IntWritable>.Context context)
		throws IOException, InterruptedException {
		System.out.print("~~~~~~~~~~~~~map");
		String [] values = value.toString().split(TProperties.getValue("fileoutsplit"));
		//values[0],values[1]
		StringBuffer sb = new StringBuffer();	
		System.out.println("6511561");
		IntWritable v = new IntWritable(1);			//项目wordcount,单词统计
		sb.append(values[2]).append(TProperties.getValue("outfilesplit"))
		.append(values[0]).append(TProperties.getValue("outfilesplit"))
		.append(values[1]).append(TProperties.getValue("outfilesplit"));
	
		//System.out.println("~~~~~~~~map"+k.toString());
		Text okey = new Text(sb.toString());
		context.write(okey,v);
	}
		
}


